<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>范闲商城-物流信息</title>
	<link rel="stylesheet" type="text/css" th:href="@{/static/css/reset.css}">
	<link rel="stylesheet" type="text/css" th:href="@{/static/css/main.css}">
	<link rel="stylesheet" th:href="@{/static/layui/css/layui.css}">
	<script th:src="@{/static/jquery-2.1.4.js}" type="text/javascript" charset="utf-8"></script>
	<script th:src="@{/static/layui/layui.js}" type="text/javascript" charset="utf-8"></script>
	<script th:src="@{/static/mylayer.js}" type="text/javascript" charset="utf-8"></script>
	<link rel="stylesheet" th:href="@{/static/step/layui/css/layui.css}" />
	<link rel="stylesheet" th:href="@{/static/step/layui/mods/extend/step/step.css}" />
	<style>
		.avatar-img {
			width: 20px; /* 设置头像图片的宽度 */
			height: 20px; /* 设置头像图片的高度，可以根据需要调整 */
			border-radius: 50%; /* 使图片呈现圆形 */
			margin-right: 10px; /* 设置头像图片与用户名之间的间距，可以根据需要调整 */
		}
	</style>
</head>
<body>
	<div th:replace="header::top"></div>

	<div class="search_bar clearfix">
		<a href="/" class="logo fl"><img src="/static/pic/fanxian-mall.png" width="150px" height="60px"></a>
		<div class="sub_page_name fl">|&nbsp;&nbsp;&nbsp;&nbsp;物流信息</div>
		<div class="search_con fr">
			<input type="text" id="searchInput" class="input_text fl" placeholder="搜索商品">
			<input type="button" id="searchButton" class="input_btn fr" value="搜索">
		</div>		
	</div>

	<div class="common_list_con clearfix">
		<table class="layui-table" lay-skin="line" style="width: 95%; margin-left: auto; margin-right: auto; margin-top: 20px; margin-bottom: 20px;">
			<colgroup>
				<col width="5%">
				<col width="25%">
				<col width="25%">
				<col width="15%">
				<col width="15%">
				<col width="15%">
				<col>
			</colgroup>
			<thead>
			<tr>
				<th></th>
				<th>商品图片</th>
				<th>商品名称</th>
				<th>商品价格</th>
				<th>数量</th>
				<th>小计</th>
			</tr>
			</thead>
			<tbody id="LAY_OrderCartList">
			<tr>
				<th>1</th>
				<th><img src="/static/images/goods/goods003.jpg"></th>
				<th>大兴大棚草莓</th>
				<th>16.80元</th>
				<th>1</th>
				<th>16.80元</th>
			</tr>
			</tbody>
		</table>
	</div>
	<div class="common_list_con clearfix">
		<div style="width: 95%; margin-left: auto; margin-right: auto; margin-top: 20px; margin-bottom: 20px; display: flex; align-items: center;">
			<img src="/static/images/sf.jpg" style="height: 50px; width: 50px; margin-right: 20px;">
			<p style="margin-right: 20px; font-size: 20px;">顺丰快递</p>
			<p style=" font-size: 20px;">SF<em id="trackNumber" style=" font-size: 15px;"></em></p>
		</div>
		<hr>
		<div class="layui-timeline" style="width: 95%; margin-left: auto; margin-right: auto; margin-top: 20px; margin-bottom: 20px;">
			<div id="qianshou">
				
			</div>

			<div class="layui-timeline-item">
				<i class="layui-icon layui-timeline-axis"></i>
				<div class="layui-timeline-content layui-text">
					<h3 class="layui-timeline-title">派送中</h3>
					<p>快递正派送中</p>
				</div>
			</div>
			<div class="layui-timeline-item">
				<i class="layui-icon layui-timeline-axis"></i>
				<div class="layui-timeline-content layui-text">
					<h3 class="layui-timeline-title">运输中</h3>
					<p>快递运输中</p>
				</div>
			</div>
			<div class="layui-timeline-item">
				<i class="layui-icon layui-timeline-axis"></i>
				<div class="layui-timeline-content layui-text">
					<h3 class="layui-timeline-title">已发货</h3>
					<p>商品已经发货</p>
				</div>
			</div>
			<div class="layui-timeline-item">
				<i class="layui-icon layui-timeline-axis"></i>
				<div class="layui-timeline-content layui-text">
					<h3 class="layui-timeline-title">已下单</h3>
					<p>商品已经下单</p>
				</div>
			</div>
		</div>
	</div>

	<div class="order_submit clearfix">
		<a href="/page/user/order">返回订单列表</a>
	</div>	

	<div class="footer">
		<div class="foot_link">
			<a href="#">关于我们</a>
			<span>|</span>
			<a href="#">联系我们</a>
			<span>|</span>
			<a href="#">招聘人才</a>
			<span>|</span>
			<a href="#">友情链接</a>		
		</div>
		<p>CopyRight © 2024 北京鑫鑫科技有限公司 All Rights Reserved</p>
		<p>电话：010-8888888    京ICP备88888888号</p>
	</div>

	<script type="text/javascript">
		$('#searchButton').click(function() {
			var searchText = $('#searchInput').val(); // 获取搜索框中的值
			var searchUrl = '/page/list?search=' + encodeURIComponent(searchText); // 构建带有搜索关键字的URL
			window.location.href = searchUrl; // 跳转到另一个页面
		});
		var queryString = window.location.search;
		var urlParams = new URLSearchParams(queryString);
		var orderNo = urlParams.get("orderNo");
		$('#trackNumber').text(orderNo);
		$.post(
				'/order/orderByOrderNo',
				{'orderNo': orderNo},
				function (result) {
					if (result.code == 0) {
						if (result.data.status === 50) {
							var html = '';
							$(result.data).each(function () {
								html += '<div class="layui-timeline-item">'
								html += '	<i class="layui-icon layui-timeline-axis"></i>'
								html += '	<div class="layui-timeline-content layui-text">'
								html += '		<h3 class="layui-timeline-title">已签收</h3>'
								html += '		<p>快递已签收</p>'
								html += '	</div>'
								html += '</div>'
							});
							$('#qianshou').append(html);
						}
					}
				},
				'json'
		);
		$.post(
				'/order/orderItemByOrderNo',
				{'orderNo': orderNo},
				function (result) {
					if (result.code == 0) {
						var html = '';
						var count = 1; // 初始化计数器
						var totalQuantity = 0; // 初始化商品总数量
						var totalPrice = 0; // 初始化总金额
						$('#LAY_OrderCartList').empty();
						$(result.data).each(function () {
							html += '<tr>'
							html += '	<th>'+count+'</th>'
							html += '	<th><img src="'+this.productImage+'"></th>'
							html += '	<th>'+this.productName+'</th>'
							html += '	<th>'+this.currentUnitPrice+'元</th>'
							html += '	<th>'+this.quantity+'</th>'
							html += '	<th>'+this.currentUnitPrice+'元</th>'
							html += '</tr>'
							count++;
							totalQuantity += this.quantity; // 累加商品数量
							totalPrice += this.quantity * this.currentUnitPrice; // 累加总金额
						});
						$('#LAY_OrderCartList').append(html);
						$('.total_goods_count em').text(totalQuantity); // 更新商品总数量
						$('#totalCost').text(totalPrice); // 更新商品总价格
					}
				},
				'json'
		);


		function logout() {
			layer.confirm(
					'您确认要退出么',
					{icon:3},
					function() {
						$.post(
								'/user/logout',
								function (result) {
									if (result.code == 0) {
										mylayer.okMsg(result.msg);
										setTimeout(function() {
											window.location.reload();
										}, 800);
									}
								},
								'json'
						);
						// location.href = '/admin?method=logout'
					}
			);
		}
	</script>
</body>
</html>